--- (6)Debianの各種インストール方法を試す- その2---

b) EMモードでHDD領域を自由に設定し、バイナリ・イメージをFTPで転送する方法

ここで報告する内容は、こちらの参考サイトを丸々真似した結果です。

   玄箱 - Debian Linuxをインストールしてみる(おもにパソコンのこと)
   http://rihi.cocolog-nifty.com/blog/2006/07/_debian_linux_f41e.html

参考サイトにならって、私も色分けしてみました。
    青色:私め記載のコメント
    赤色;入力コマンド
    黒色:コンソールに出力された文字

参考サイトでは、コマンドをフルパスで入力していますが、皆パスが通っていたので
私はあえてフルパスでなく、コマンドのみ入力としてみました。

EMモードに入る方法は、「(5)EMモードについて」を参照下さい。
-------------------------------------------------------------------
*** HDD領域全部を削除 ***
# mfdisk -e /dev/hda
delete partition 1
delete partition 2
delete partition 3
create partitions...
deleate all partitions.
The partition table has been altered!

Syncing disks.
-------------------------------------------------------------------
*** HDD領域確保 ***
HDDは40GBで、先頭より以下の通り
   Linux用・・・8GB
   Swap用・・・512MB
   データ用・・・残り


# mfdisk -c /dev/hda
     まずは領域確保
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4870, default 1): [入力なしでenter]
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4870, default 4870): +8000M

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1021-4870, default 1021):[入力なしでenter]
Using default value 1021
Last cylinder or +size or +sizeM or +sizeK (1021-4870, default 4870): +512M

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1087-4870, default 1087):[入力なしでenter]
Using default value 1087
Last cylinder or +size or +sizeM or +sizeK (1087-4870, default 4870):[入力なしでenter]
Using default value 4870
      第2パーティションをスワップとして予約
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap)
      「p」で設定結果の確認
Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 4870 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 1020 8193118+ 83 Linux
/dev/hda2 1021 1086 530145 82 Linux swap
/dev/hda3 1087 4870 30394980 83 Linux
     最後に、予約したパーティションを書きこむ
Command (m for help): w
The partition table has been altered!

Syncing disks.
#
-------------------------------------------------------------------
*** 第1領域(Linux用)のフォーマット ***
# mke2fs -j /dev/hda1
mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1026144 inodes, 2048279 blocks
102413 blocks (5.00%) reserved for the super user
First data block=0
63 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

*** 第2領域をSWAPに ***
# mkswap /dev/hda2
Setting up swapspace version 1, size = 542863360 bytes

*** 第3領域のフォーマット ***
# mke2fs -j -m 0 /dev/hda3
mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3801088 inodes, 7598745 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
232 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

*** 念のために/hda3のパラメータを調整 ***
*** 予約ファイルシステムのオフです ***

# tune2fs -m 0 /dev/hda3
tune2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09
Setting reserved blocks percentage to 0 (0 blocks)
-------------------------------------------------------------------
*** マウント作業 ***
# mount -t ext3 /dev/hda1 /mnt
# mount -t ext3 /dev/hda3 /mnt2
-------------------------------------------------------------------
*** 作成した領域の確認 ***
# df -h
Filesystem Size Used Available Use% Mounted on
/dev/ram0 9.5M 5.0M 4.5M 53% /
/dev/hda1 7.7G 32.1M 7.3G 0% /mnt
/dev/hda3 28.5G 32.1M 28.5G 0% /mnt2
-------------------------------------------------------------------
以上で、HDDの領域作製完了!
-------------------------------------------------------------------
*** データ領域にディレクトリ「share」作成 ***
# mkdir /mnt2/share
   FTPで転送するDebianのバイナリ・イメージを保存する場所です
-------------------------------------------------------------------

*************************************************
***   FTPで /mnt2/share にDebianイメージを転送   ***
***   (WindowsPCよりフリーソフト「FFFTP」にて)     ***
*************************************************

ここでは、「玄箱うぉううぉう(http://kuro.dsk.jp/)」より
「debian_2006_06_10_dist.tgz(Debian3.0)」を拝借しました。


WindowsPC側でFTPクライアントソフト「FFFTP ver.1.97a」を使用しました。


-------------------------------------------------------------------
*** 転送できた事の確認 ***
# ls /mnt2/share
debian_2006_06_10_dist.tgz

*** /mnt に移動する ***
# CD /mnt

*** /mnt にDebianを展開する ***
# tar xvzf /mnt2/share/debian_2006_06_10_dist.tgz

*** 展開完了までは、かなり時間がかかる ***
-------------------------------------------------------------------
展開完了後の作業です
※アドレス等の数値は、使用する環境によって異なります。

*** ネットワークの設定をしておく ***
# vi /mnt/etc/network/interfaces

*** ネットワークの設定の確認 ***
# cat /mnt/etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
iface eth0 inet static
address 192.168.0.58
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1

iface lo inet loopback

auto eth0 lo

*** hosts の編集と確認 ***
# vi /mnt/etc/hosts

# cat /mnt/etc/hosts
127.0.0.1 localhost
192.168.0.58 KURO-BOX

*** hosts.allow の編集と確認 ***
# vi /mnt/etc/hosts.allow

# cat /mnt/etc/hosts.allow
# /etc/hosts.allow: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5), hosts_options(5)
# and /usr/doc/netbase/portmapper.txt.gz
#
# Example: ALL: LOCAL @some_netgroup
# ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
#
# If you're going to protect the portmapper use the name "portmap" for the
# daemon name. Remember that you can only use the keyword "ALL" and IP
# addresses (NOT host or domain names) for the portmapper. See portmap(8)
# and /usr/doc/portmap/portmapper.txt.gz for further information.
#
#ALL : 192.168.0.0/255.255.255.0
ALL : ALL : ALLOW

*** resolv.conf の編集と確認 ***
# vi /mnt/etc/resolv.conf

# cat /mnt/etc/resolv.conf
search
nameserver 192.168.0.1

*** 最後に、EMモードから通常に復帰するコマンド ***

# echo -n 'OKOK' > /dev/fl3
# reboot

************************************************
*** 再起動後の、ログイン前後のコンソール表示 ***
************************************************

Debian GNU/Linux 3.0 KURO-BOX ttyS0

KURO-BOX login: root
Password:[パスワードの入力]  (デフォルトのパスワードはユーザ名に同じ)
Last login: Sun Apr 25 19:16:34 2004 from 192.168.0.12 on pts/0
Linux KURO-BOX 2.4.17_kuro-box #4 2004? 4キ・16ニ・カ簣ヒニ・11:45:05 JST ppc unknown

Most of the programs included with the Debian GNU/Linux system are
freely redistributable; the exact distribution terms for each program
are described in the individual files in /usr/share/doc/*/copyright

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
1 failure since last login. Last was 21:02:14 on pts/0.
KURO-BOX:~#
-------------------------------------------------------------------
*** HDD内容の確認 ***
KURO-BOX:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 7.7G 151M 7.1G 3% /
/dev/hda3 28G 70M 28G 1% /mnt
KURO-BOX:~#
-------------------------------------------------------------------

Return

Home

2010/12/02